<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - CombineField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!--[if IE 6]>
<link type='text/css' rel='stylesheet' href='../css/inputEx-IE6.css' />
<![endif]-->

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body>

<h1>inputEx - CombineField Usage</h1>


<!-- Example 1 -->
<div class='exampleDiv'>
	<h2>Basic CombineField creation</h2>
	<p></p>
	<div class='demoContainer' id='container1'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var field = new inputEx.CombineField({
				parentEl: 'container1', 
				label: 'Your name',
				description: 'Please enter your name',
				fields: [
					{ name: 'firstname', typeInvite: 'firstname' },
					{ name: 'lastname', typeInvite: 'lastname' }
				],
				separators: [false,"&nbsp;&nbsp;&nbsp;",false],
				required:true
			});

		   var el = YAHOO.util.Dom.get('container1');

			var button1 = inputEx.cn('button', null, null, "SetValue with ['Jimi','Hendrix']");
			var val = ['Jimi','Hendrix'];
			el.appendChild(button1);
			YAHOO.util.Event.addListener(button1, "click" ,function() {
			   field.setValue(val);
			   val = (val[0] == 'Jimi') ? ['',''] : ['Jimi','Hendrix'];
			   button1.innerHTML = "SetValue with "+((val[0] == 'Jimi') ? "['Jimi','Hendrix']" : "['','']");
			});

			var logDiv = inputEx.cn('div', null, null, "Log :");
			el.appendChild(logDiv);
			field.updatedEvt.subscribe(function(e,params) {
				var value = params[0];
				logDiv.innerHTML += "Updated at "+(new Date())+" with value "+value;
				logDiv.appendChild(inputEx.cn('br'));
			});
		</textarea>
	</div>
</div>


<!-- Example 2 -->
<div class='exampleDiv'>
	<h2>Basic CombineField creation</h2>
	<p></p>
	<div class='demoContainer' id='container2'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new inputEx.CombineField({
				parentEl: 'container2', 
				label:'Select Datetime :',
				fields: [
					{type: 'date', name: 'date', typeInvite: 'mm/dd/YYYY' },
					{type: 'time', name: 'time' }
				],
				separators: [false,"&nbsp;",false]
			});
		</textarea>
	</div>
</div>



<!-- Example 3 -->
<div class='exampleDiv'>
 <h2>Field names</h2>
 <p>The names are automatically set on sub-fields, so that standard forms can work. Click the button and check the URL</p>
 <div class='demoContainer' id='container3'></div>
 <div class='codeContainer'>
  <textarea name="code" class="JScript">	
    new inputEx.Form( {
			fields: [
			{
				name: 'firstVar',
				label: "First variable",
				value: "my-custom-value"
			},
			
			{
				type: 'list',
				label: "My Array",
				maxItems: 4,
				minItems: 1,
				elementType: {
					type: 'combine',
					description: 'Please enter your name',
					name: 'this_is_a_test',
					fields: [
						{ name: 'firstname', typeInvite: 'firstname' },
						{ name: 'lastname', typeInvite: 'lastname' }
					],
					value: ['Jimi','Hendrix'],
					name: "person",
					separators: [false,"&nbsp;&nbsp;&nbsp;",false],
				},
				value: [['Jimi','Hendrix'], ['Eric', 'Clapton']],
				name: 'myarray',
				useButtons: true ,
				sortable: true
			}
			
			
			],
      buttons: [{type: 'submit', value: 'Test to send the GET request'}],
			method: 'GET',
			parentEl: 'container3'
		});
  </textarea>
 </div>
</div>


<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>


<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/mixins/choice.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/Group.js"  type='text/javascript'></script>
<script src="../js/Form.js"  type='text/javascript'></script>
<script src="../js/widgets/Button.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/SelectField.js"  type='text/javascript'></script>
<script src="../js/fields/CombineField.js"  type='text/javascript'></script>
<script src="../js/fields/TimeField.js"  type='text/javascript'></script>
<script src="../js/fields/DateField.js"  type='text/javascript'></script>
<script src="../js/fields/ListField.js"  type='text/javascript'></script>


<!-- inputEx examples -->
<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>

 </body>
</html>